<?

/**
 * entry Header already being obsolete
 */
$menuEntryHeader="";

$menuEntryDetail = "<?

\$Db = new ".$dbTech.";
\$Db->init(\$_SESSION[\"ORCL\"],
           \$_SESSION[\"OPASS\"],
           \$_SESSION[\"SID\"],
           _NO_COMMENT);

if(\$Db->connect()){

?>

  <?=\$GJs->includeThis(_TYPE_CSS,\"/ecs/myMenu.css\") ?>
  <?=\$GJs->includeThis(_TYPE_JS ,\"/ecs/javascript/GMisc.js\") ?>
  <?=\$GJs->includeThis(_TYPE_JS ,\"/ecs/javascript/GAjax.js\") ?>
  <?=\$GJs->includeThis(_TYPE_JS ,\"javascript/misc.js\") ?>
  <?=\$GJs->includeThis(_TYPE_JS ,\"javascript/ajax.js\") ?>
  <?=\$GJs->stopRKey() ?>

  <SCRIPT LANGUAGE=\"JavaScript\" SRC=\"../javascript/CalendarPopup.js\"></SCRIPT>
  <SCRIPT LANGUAGE=\"JavaScript\">
  var cal      = new CalendarPopup();
  </SCRIPT>

  <body>
  <form name=\"initMe\"  action=entry.php  method=post>

  <table border=\"1\" class=\"dedeq\" >
  <tr>

    <td class=\"solid\"> DATE
      <input type=\"submit\"
             onClick=\"cal.select(document.forms['initMe'].trDateEnt,
                                 'anchor1',
                                 'dd-MM-yyyy');
                      return false;\"
             NAME   =\"anchor1\"
             ID     =\"anchor1\"
             value  =\"Select\"> </td>
        <td > <?=\$GHtml->formInput(\"trDateEnt\",
                                   \$_POST[\"trDateEnt\"],
                                   \$Misc->stdProperties()) ?> </td>

  </tr>
  </table><br/>

<?

  if(\$_SESSION[\"modify_mode\"] == \"Y\"){


  }else{


  }
?>

  <?=\$GHtml->formInputButton( \"Entry-data\",
                             \"entry\",
                             \"Entry-data\",
                             \$stlButton) ?>

  <?=\$GHtml->formInputButton( \"Add-row\",
                             \"addrow\",
                             \"Add-row\",
                             \$stlButton) ?>

  <?=\$GHtml->formInputButton( \"Add-Tx\",
                             \"addTx\",
                             \"Add-Tx\",
                             \$stlButton) ?>

  <?=\$GHtml->formInputButton( \"Drop-row\",
                             \"droprow\",
                             \"Drop-row\",
                             \$stlButton) ?>

  </form>
  </body>

<?

  \$Db->dc();
}else{

  \$Misc->usrDie(_DB_CONN_ERROR);
}

?> ";

$menuEntryConfirm = "<?

echo \"MODIFY MODE :\" 	.\$_SESSION[\"modify_mode\"]. \"<br/>\\n\";

if(\$_SESSION[\"modify_mode\"] == \"Y\"){

	\$status_of_write=\"Modify\";
}else{

	\$status_of_write=\"Confirm\";
}

/**
* Detail goes here
*
*/
?>

<?=\$GHtml->formInputButton( \"Save\",
                         \"confirm\",
                         \"Confirm\",
                         \$stlButton) ?>

<?=\$GHtml->formInputButton( \"Back\",
                         \"back\",
                         \"Back\",
                         \$stlButton) ?>

</form> ";

$menuEntryCheck = "<?

\$dataup = 0;
\$uprun  = true;

/**
* Check the entry
*
*/
for(\$iRow = 0; \$iRow < \$_SESSION[\"init_num\"]; \$iRow++){

  /**
  * Check for each master detail
  *
  */
  if(\$_POST[\"modelEnt\"][\$iRow] == '' &&
     \$_POST[\"qtyEnt\"][\$iRow]   == ''){

    for(\$iNext = (\$iRow + 1); \$iNext < \$_SESSION[\"init_num\"]; \$iNext++ ){

      if(\$_POST[\"modelEnt\"][\$iNext] != '' ||
         \$_POST[\"qtyEnt\"][\$iNext]    != ''){

        \$uprun = false;

        \$Misc->usrError(\"Invalid Entry at : \".(\$iNext + ARRAY_NUMBER).\" \");

        break;
      }
    }

    if(\$uprun == false){

      /* out of this loop */
      break;
    }
  }else{

    if(\$_POST[\"modelEnt\"][\$iRow] != '' &&
       \$_POST[\"qtyEnt\"][\$iRow]   != ''){

      \$dataup++;
    }else{

      \$uprun = false;

      \$Misc->usrError(\"Invalid Entry at : \".(\$iRow + ARRAY_NUMBER).\" \");
    }
  }
}

if(\$dataup == 0 ){

	\$Misc->usrError(\"ERROR: Data is empty\");

	\$Misc->jumpTo(2,\"../\".\$_SESSION[\"source_caller\"]);
}

if(\$uprun == true && \$dataup > 0){

	/**
	* We are good with details
	* continue with the header check
	*
	*/
	if(\$_POST[\"trDateEnt\"]    != '' ){

		//everything is good
		//open confirmation form
		if(!\$_POST[\"confirm\"] && !\$_POST[\"back\"]){

			require(\"entry_upload_confirm.php\");
		}elseif(\$_POST[\"back\"]){

			require(\"entry_restore_me.php\");
		}else{

			/**
			* Prepare to upload
			* modify mode is on
			*
			*/
			if(\$_SESSION[\"modify_mode\"] == \"Y\" && \$_SESSION[\"jid\"] != ''){

				require(\"upmodifytodb.php\");
			}elseif(\$_SESSION[\"modify_mode\"] != \"Y\"){ //if modify mode is off

				require(\"upentrytodb.php\");
			}else{

				\$Misc->usrError(\"Unknown Upload Task\");
			}
		}
	}else{

		\$Misc->usrError(\"Error: header incompleted\");

		require(\"entry_restore_me.php\");
	}
}

if(\$uprun == false){

	echo \"Restoring...\\n\";
	\$restore  = 0;
	\$uprun    = 0;
	\$dataup   = 0;

	require(\"entry_restore_me.php\");
}
?> ";

?>